package com.cy.pj.goods.controller;

import com.cy.pj.goods.pojo.Goods;
import com.cy.pj.goods.service.GoodsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import java.util.List;

@Slf4j
@RestControllerAdvice
public class JsonGoodsController {

    @Autowired
    private GoodsService goodsService;

    @ResponseBody
    @GetMapping("doFindJsonGoods")
    public JsonResult doFindJsonGoods(String name){
        List<Goods> list = goodsService.findByName(name);
        return new JsonResult(list);
    }
}
